#include <stdlib.h>
#include <directfb.h>

#include "dtk_types.h"
#include "dtk_debug.h"
#include "dtk_actor.h"
#include "dtk_line.h"

const DString DTK_TYPE_LINE = "DTKLine";

void line_paint(DTKActor* self, DRegion* region, DBoolean flag)
{
    IDirectFBSurface* surface = NULL;
    DTKLine* line = (DTKLine*) self;

    DTK_TYPE_ASSERT (self, DTK_TYPE_LINE);

    dtk_region_dump (__func__, region);

    surface = dtk_actor_get_surface (self);
    if (surface == NULL)
    {
        return;
    }

    dtk_actor_release_surface (self);
    return;    
}

DTKActor* dtk_line_new(void)
{
    DTKActor*       actor;
    DTKActorCallback*       funcs;
    DColor                color = {0x00, 0x00, 0x00, 0xff};

    actor = dtk_actor_init(sizeof(DTKLine), DTK_TYPE_LINE,
        DACAPS_NONE, NULL);

    dtk_line_set_color (actor, &color);
    
    funcs = DTK_ACTOR_CALLBACK(actor);

    return actor;
}

void dtk_line_set_color (DTKActor* self, DColor* color)
{
    DTKLine* line = (DTKLine*) self;

    DTK_TYPE_ASSERT (self, DTK_TYPE_LINE);

    line->color = *color;
    return;
}

void dtk_line_get_color (DTKActor* self, DColor* color)
{
    DTKLine* line = (DTKLine*) self;

    DTK_TYPE_ASSERT (self, DTK_TYPE_LINE);

    *color = line->color;
    return;
}

